import java.io.File;
import java.io.IOException;

public class one {

    public static void main(String[] args) throws IOException {
        File file = new File("E:"+File.separator + "test.txt");
//        try {
//            boolean newFile = file.createNewFile();
//            if (!newFile) System.out.println("create file failed");
//            else System.out.println("create file succeeded");
//        } catch (Exception e){
//            System.out.println(e.getMessage());
//        }
        if (file.exists()) file.delete();
        else {
            try {
                boolean newFile = file.createNewFile();
                if (!newFile) System.out.println("create file failed");
                else System.out.println("create file succeeded");
            }catch (Exception e) {
                System.out.println(e.getMessage());
            }
        }
    }

}
